/***************************************************************************
 *   Copyleft 2006-2007 by												   *
 *	 Iwanicki Krzysztof													   *
 *   <gamma.mini.pw.edu.pl/~iwanickik>									   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 ***************************************************************************/
#ifndef __BSPLINESURFACEMANAGER_H__
#define __BSPLINESURFACEMANAGER_H__

#include "./Cursor3DManager.h"
#include "../Objects/Surfaces/BSplineSurface.h"
#include "../Scene/Scene3D.h"
#include "../Engine3D.h"

class BSplineSurfaceManager: public Cursor3DManager { 
private:
	enum CURVE_STATE {
		CURVE1 = 0,
		CURVE2,
		SURFACE
	};
	struct SelectedPointCords {
		cInt mHoriz;
		cInt mVert;
	};
	CURVE_STATE mState;
	SelectedPointCords mSelectedPoint;
	BSplineCurve* mBSpline1;
	BSplineCurve* mBSpline2;


	cVoid PrepareSurface(Engine3D* engine);
	cVoid OnTransform(cUShort cmd, Engine3D* engine);
	cVoid OnChangeParams(cUShort cmd, Engine3D* engine);
	cVoid FindPoint(cBool bRemember);
	cVoid FindPoint();
	cVoid SelectPoint();
	cVoid DeselectPoint();
public:

    /**************************************************************
    * Constructors                                                *
    ***************************************************************/
    BSplineSurfaceManager(BSplineCurve* bSpline1, BSplineCurve* bSpline2, BSplineSurface* surface, Cursor3D* cursor);
	BSplineSurfaceManager(BSplineSurface* surface, Cursor3D* cursor);
        
    /**************************************************************
    * Operators                                                   *
    ***************************************************************/


    /**************************************************************
    * Other helpful functions                                     *
    ***************************************************************/
	virtual cVoid OnMouseMove(cPoint point, Engine3D* engine);
	virtual cVoid OnMouseWheel(cInt iDelta, Engine3D* engine);
	virtual cVoid OnCommand(HWND hwnd, WPARAM wParam, LPARAM lParam, Engine3D* engine);
	virtual cVoid OnLeftMouseDown(cPoint point, Engine3D* engine);
	virtual cVoid OnLeftMouseUp(cPoint point, Engine3D* engine);
	virtual cVoid OnRightMouseDown(cPoint point, Engine3D* engine);
};                                                                 

#endif // __BSPLINESURFACEMANAGER_H__